package com.order.ctl;

import com.payment.client.PaymentHystrixClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * dongzhihua
 * 2022/10/22 23:42
 */
@RestController
@RequestMapping("hystrix")
public class OrderHystrixCtl {

    @Resource
    private PaymentHystrixClient paymentHystrixClient;

    @RequestMapping("success")
    String timeout() {
        return "order " + paymentHystrixClient.success();
    }

    @RequestMapping("timeout")
    String timeout(@RequestParam(name = "seconds") Integer seconds) {
        return "order " + paymentHystrixClient.timeout(seconds);
    }
}
